import 'package:ls_work/net/response/food/week_menu_list_data.dart';
import 'package:ls_work/util/ext_utils.dart';

class WeekChooseData{
  String? name;
  int? max;


  WeekChooseData({this.name, this.max});

  var goodsList = <GoodsList>[];

  List<GoodsList> get selectList => goodsList.takeWhere<GoodsList>((element) => element.status==1).toList();

  List<GoodsList> get paidList => goodsList.takeWhere<GoodsList>((element) => element.oldStatus==1).toList();

  int get selectNum {
    var num = 0;
    for(var item in selectList){
      num+=(item.number??0);
    }
    return num;
  }

  double get selectPrice{
    var price = 0.0;
    for(var item in goodsList){
      price+=(item.number??=0)*item.price!;
    }
    return price;
  }

  double get paidPrice{
    var price = 0.0;
    for(var item in selectList){
      if(item.oldStatus==1){
        price+=(item.oldNumber??=0)*item.price!;

      }
    }
    return price;
  }


}


